<?php
    require_once('../code/global.php');
    require_once('/code/Admin.php');
    require_once('/code/SiteInfo.php');
    require_once('/code/Artist.php');
    $admin=new Admin();
    $admin->loginCheck(1);
    $siteInfo=new SiteInfo();
    $s=$siteInfo->getSiteInfo();
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
        <title>PhotoFromThe1st 后台管理系统</title>
        <link rel="stylesheet" href="/styles/admin.css" type="text/css" media="all">
        <script type="text/javascript" src="/script/jquery-1.6.1.min.js"></script>
        <script type="text/javascript" src="/script/script.js"></script>
</head>
<body>
    <div class="msgBox"><?php echo isset($_GET['msg']) ? $_GET['msg'].'<script language=javascript>alert(\''.$_GET['msg'].'\');</script>' : '修改网站设置' ?>  <a href="accountInfo.php">返回</a></div>

        <table border="0" cellspacing="0" cellpadding="0" class="detailTable">
            <form id="editSiteInfo" name="editSiteInfo" method="post" action="exec.php">
                <input name="action" type="hidden" value="editSiteInfo">
            <tr class="btnTr header"><td colspan="2"><input class="btnLnk" type="submit" name="save" value="Save" onclick="wait()"><input class="btnLnk" type="reset" name="reset" value="Reset"><input class="btnLnk" type="button" name="cancel" value="Cancel" onclick="location.href='accountInfo.php'"></td></tr>
            <tr><td>Site Name:</td><td><input type="text" name="site_name" maxlength="64" class="inputBox" value="<?php echo $s['site_name'] ?>"></td></tr>
            <tr><td>Site Keyword:</td><td><input type="text" name="meta_keyword" maxlength="64" class="inputBox" value="<?php echo $s['meta_keyword'] ?>"></td></tr>
            <tr><td>Site Description:</td><td><input type="text" name="meta_description" maxlength="64" class="inputBox" value="<?php echo $s['meta_description'] ?>"></td></tr>
            <tr><td>Contact Email:</td><td><input type="text" name="contact_email" maxlength="64" class="inputBox" value="<?php echo $s['contact_email'] ?>"></td></tr>
            <tr><td>Address:</td><td><textarea name="address" class="textAdr"><?php echo $s['address'] ?></textarea></td></tr>
            <tr><td>About Us:</td><td><textarea name="site_about"><?php echo $s['site_about'] ?></textarea></td></tr>
            <tr><td>Terms&Conditions:</td><td><textarea name="terms_condition"><?php echo $s['terms_condition'] ?></textarea></td></tr>
            <tr><td>Frontpage Photo<br />Photographer:</td><td>
                <select name="frontpage_artist_id">
                            <option value="0"></option>
                            <?php
                                $artist=new Artist();
                                $a=$artist->getArtists(0);
                                $a_count=count($a);
                                $j=0;
                                while($j<$a_count){
                                    echo '<option value="'.$a[$j]['artist_id'].'"'.($a[$j]['artist_id']==$s['frontpage_artist_id']?' selected':'').'>'.$a[$j]['name'].'</option>';
                                    ++$j;
                                }
                            ?>
                </select>
            </td></tr>
            <tr><td>Frontpage Photo<br />Subject:</td><td><input type="text" name="frontpage_photo_subject" maxlength="64" class="inputBox" value="<?php echo $s['frontpage_photo_subject'] ?>"></td></tr>
            <tr><td>Watermark Text:</td><td><input type="text" name="watermark_text" maxlength="64" class="inputBox" value="<?php echo $s['watermark_text'] ?>"></td></tr>
            <tr><td>Transparency:</td><td><input type="text" name="watermark_transparency" maxlength="3" value="<?php echo $s['watermark_transparency'] ?>"> 水印透明度，值越大越透明，推荐20</td></tr>
            <tr><td>Image Fontsize:</td><td><input type="text" name="watermark_fontsize_img" maxlength="3" value="<?php echo $s['watermark_fontsize_img'] ?>"> 大图水印字号</td></tr>
            <tr><td>Thumb Fontsize:</td><td><input type="text" name="watermark_fontsize_thumb" maxlength="3" value="<?php echo $s['watermark_fontsize_thumb'] ?>"> 缩略图水印字号</td></tr>
            <tr class="btnTr header"><td colspan="2"><input class="btnLnk" type="submit" name="save" value="Save"><input class="btnLnk" type="reset" name="reset" value="Reset"><input class="btnLnk" type="button" name="cancel" value="Cancel" onclick="location.href='accountInfo.php'"></td></tr>
            </form> 
            <form name="uploadHomeImg" action="exec.php" method="post" enctype="multipart/form-data">
                <input type="hidden" name="action" value="uploadHomeImg"><input type="hidden" name="max_file_size" value="10000000">
            <tr><td>Frontpage Photo:<br />(400×550px MAX)</td><td><input type="file" name="imgFile"><input class="btnLnk" type="submit" id="btnUpload" value="Upload Frontpage Photo" onclick="wait()"></td></tr>
            </form>
            <tr><td></td><td><img src="<?php echo $siteInfo->HOMEPAGE_IMG_URL.'?'.rand() ?>" title="<?php echo $s['frontpage_photo_subject'] ?>"></td></tr>
            <tr class="seperator"><td colspan="2"></td></tr>
            <form name="uploadAboutImg" action="exec.php" method="post" enctype="multipart/form-data">
                <input type="hidden" name="action" value="uploadAboutImg"><input type="hidden" name="max_file_size" value="10000000">
            <tr><td>About Us Image:<br />(auto resize)</td><td><input type="file" name="imgFile"><input class="btnLnk" type="submit" id="btnUpload" value="Upload About Us Image" onclick="wait()"></td></tr>
            </form>
            <tr><td></td><td><img src="<?php echo $siteInfo->ABOUT_IMG_URL.'?'.rand() ?>"></td></tr>
            <tr class="seperator"><td colspan="2"></td></tr>
        </table>
</body>
</html>